#pragma once



template<class Iterator,class Ref,class Ptr>
struct ReverseIterator
{
	Iterator cur;

	typedef ReverseIterator<Iterator ,Ref ,Ptr> Self;

	ReverseIterator(Iterator it)
		:cur(it)
	{}

	Self& operator++()
	{
		--cur;
		return *this;
	}

	Self operator++(int)
	{
		Self tmp(*cur);
		--cur;
		return tmp;
	}
	Self& operator--()
	{
		++cur;
		return *this;
	}
	Self operator--(int)
	{
		Self tmp(*cur);
		++cur;
		return tmp;
	}

	Ref operator*()
	{
		Iterator tmp = cur;
		--tmp;
		return *tmp;
	}
	
	Ptr operator->()
	{
		return &(operator*());
	}

	bool operator!=(const Self& s)
	{
		return cur != s.cur;
	}
};